import torch
import json
import LeNet.net

model = LeNet.net.LeNet()
model.load_state_dict(torch.load('LeNet/LeNet.pth'))

data = []
for x in model.named_parameters():
    data.append({"layer":x[0],"value":x[1].detach().tolist()})

jsonString = json.dumps(data)
with open('value.json', 'w') as f:
    f.write(jsonString)